package cc.yugu.yhdw.webserver.service.basic;

import cc.yugu.yhdw.common.domain.basic.AlipayPayOrder;
import cc.yugu.yhdw.common.entity.pagination.Page;
import cc.yugu.yhdw.webserver.persistence.basic.AlipayPayOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 支付宝支付订单业务
 * 
 * @Date:Created in 2018/7/3 13:56
 * @Author:
 * @Modified By: zjn 2018/7/3 13:56
 */ 
@Service
public class AlipayPayOrderService {
    @Autowired
    AlipayPayOrderMapper alipayPayOrderMapper;
    /**
    * 按条件查询bas_alipay_pay_order表
    *
    * @Param: [search]
    * @Return: cc.yugu.yhdw.common.domain.basic.AlipayPayOrder
    * @Author By: zjn 2018/7/3  13:57
    */
    public AlipayPayOrder find(AlipayPayOrder search) {
        return alipayPayOrderMapper.find(search.getCustomerId(), search.getSourceType(), search.getSourceId(), search.getOrderStatus());
    }
    /**
    * 分页查询
    *
    * @Param: [search]
    * @Return: cc.yugu.yhdw.common.entity.pagination.Page
    * @Author By: zjn 2018/7/3  13:59
    */ 
    public Page findPage(AlipayPayOrder search) {
        Page page = search.buildPage();
        page.setTotalItems(alipayPayOrderMapper.findPageCount(search));
        search.setBeginIndex(page.getOffset());
        page.setResult(alipayPayOrderMapper.findPageResult(search));
        return page;
    }
}
